package com.gaogzhen.communication.parkUnpark;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

@Slf4j(topic = "c.Test02")
public class Test03 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            log.debug("start ...");
            try {
                TimeUnit.SECONDS.sleep(2);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("suspend ...");
            LockSupport.park();
            log.debug("suspend end ...");
        }, "t1");
        t1.start();
        TimeUnit.SECONDS.sleep(1);
        LockSupport.unpark(t1);
    }
}
